package com.class04;

import com.class04.dyn.ProxyFactory;
import com.class04.statics.StaticProxyCalculator;

/**
 * @ClassDescription:
 * @JdkVersion: 17
 * @Author: yxy
 * @Created: 2023/11/1 9:34
 */
public class TestMain {
    public static void main(String[] args) {
//        目标
        Calculator target = new CalculatorPureImpl();
//        中介 代理
//        Calculator proxy = new StaticProxyCalculator(target);
//        int add = proxy.add(1, 1);
//        System.out.println("add = " + add);

//        jdk动态代理对象
        ProxyFactory proxyFactory = new ProxyFactory(target);
        Calculator proxy1 = (Calculator) proxyFactory.getProxy();
        int add1 = proxy1.add(1, 1);
        System.out.println("add1 = " + add1);



    }
}
